<template>
	<page-body>
		<view class="page">
			<view
				class="flex flex-direction flex-wrap align-stretch justify-center benben-position-layout flex changePwdPhoneCode_flex_0_higd"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-stretch justify-between changePwdPhoneCode_fd0_0_higd'>
					<view class='flex flex-wrap align-center changePwdPhoneCode_fd0_0_c0_higd' @tap.stop="handleJumpDiy"
						data-type="back" data-url="1">
						<text class='fu-iconfont2  changePwdPhoneCode_fd0_0_c0_c0_higd'>&#xe794;</text>
					</view>
					<view class='flex flex-wrap align-center'>
						<text class='changePwdPhoneCode_fd0_0_c1_c0_higd'>{{$t('修改密码')}}</text>
					</view>
					<view class='flex align-center justify-end changePwdPhoneCode_fd0_0_c2_higd'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>

			<view class="flex flex-direction align-center benben-flex-layout changePwdPhoneCode_flex_1_higd">
				<text class='changePwdPhoneCode_fd1_0_higd'>{{$t('我们要对您绑定的手机号进行验证：')}}</text>
				<text class='changePwdPhoneCode_fd1_1_higd'>{{mobile}}</text>
				<benben-digital-password :box-num='4' mode='number'
					class-name="flex flex align-center justify-center changePwdPhoneCode_fd1_2_higd" v-model="code"
					:init-open.sync="xianshi">
					<template #default="{ content, active, index }">
						<view :key="index" v-if="active"
							class="flex align-center justify-center active-digital-password changePwdPhoneCode_flex_password_active_fd1_2_higd">
							{{ content }}
						</view>
						<view :key="index" v-else
							class="flex align-center justify-center changePwdPhoneCode_flex_password_active_fd1_2_higd">
							{{ content }}
						</view>
					</template>
				</benben-digital-password>
				<view class='flex flex-wrap align-center justify-center'>
					<benben-send-verification-code key='1688628102120' ref="vCode1688628102120"
						class=' changePwdPhoneCode_fd1_3_c0_higd' :after-text="$t('后重新获取')" :before-text="$t('获取验证码')"
						type='2' :is-environment-verification='true' :phone="mobiles">
					</benben-send-verification-code>
				</view>
				<button class='changePwdPhoneCode_fd1_4_higd' @tap.stop="checkCodeFunc()">{{$t('下一步')}}</button>
			</view>




		</view>
	</page-body>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	import { host } from '@/common/config.js';

	export default {
		components: {},


		data() {
			return {
				"mobile": "",
				"code": "",
				/** follow_count【关注的店铺数量】
				 *   is_pay_password【是否设置支付密码 1 已设置 0 未设置】
				 *   nickname【昵称】
				 *   certified【实名认证状态 -1 未进行认证 1 待审核 2 审核通过 3 已拒绝】
				 *   total_money【会员总金额】
				 *   browse_count【足迹数量】
				 *   collection_count【收藏数量】
				 *   _mobile【手机号不带*号】
				 *   score【积分余额】
				 *   total_consumption_money【总消费金额】
				 *   freeze_money【会员冻结金额】
				 *   user_money【会员余额】
				 *   gender【性别 1 男 2 女】
				 *   birthday【生日】
				 *   email【邮箱】
				 *   account【登录账号】
				 *   avatar【头像】
				 *   real_name【真实姓名】
				 *   mobile【手机号带*号】
				 *   userlevel_id【会员级别】
				 *   id【会员ID】
				 *   tags【标签】
				 *   hobby【爱好】
				 *   address_code【地址编码】
				 *   address【地址】
				 *   invite_code【邀请码】 **/
				"dataMessage": {
					"invite_code": "",
					"address": "",
					"address_code": "",
					"hobby": "",
					"tags": "",
					"id": "",
					"userlevel_id": "",
					"mobile": "",
					"real_name": "",
					"avatar": "",
					"account": "",
					"email": "",
					"birthday": "",
					"gender": "",
					"create_time": "",
					"user_money": "",
					"freeze_money": "",
					"total_consumption_money": "",
					"score": "",
					"_mobile": "",
					"coupon": "",
					"collection_count": "",
					"browse_count": "",
					"total_money": "",
					"certified": "",
					"nickname": "",
					"is_pay_password": "",
					"follow_count": ""
				},
				"xianshi": true,
				mobiles:''
			};
		},
		computed: {
			userInfo: {
				get() {
					return this.$store.state.userInfo
				},
				set(value) {
					this.$store.commit('updateUserInfo', value)
				},
			}
		},
		watch: {},
		onLoad(options) {
			this.getUserinfoFunc()
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//内部方法-会员-获取会员信息
			async getUserinfoFunc() {
				//请求方法
				//数据验证

				// let datadataMessage = await this.$api.get(global.apiUrls.post5c78c4772da97, {

				// });

				// if (datadataMessage.data.code != 1) {
				// 	this.$message.info(datadataMessage.data.msg);
				// 	return
				// }
				// let infodataMessage = datadataMessage.data;
				// this.dataMessage = infodataMessage.data
				
				let group=uni.getStorageSync('USER_GROUP')
				let url=group==1?global.apiUrls.post5c78c4772da97:host+'/api/v1/5c78c4772da97'
				let datadataMessage = await this.$api.get(url, {
					user_id: uni.getStorageSync('USER_INFO_7863').aid
				});
				
				if (datadataMessage.data.code != 1) {
					this.$message.info(datadataMessage.data.msg);
					return
				}
				let infodataMessage = datadataMessage.data;
				this.dataMessage = infodataMessage.data
				console.log(this.dataMessage)
				this.mobiles=group==1?this.dataMessage._mobile:this.dataMessage.mobile
				this.mobile = this.mobiles.slice(0, 3) + "****" + this.mobiles.slice(-4);
			},
			//校验验证码
			checkCodeFunc() {
				if (!validate(this.code, 'require')) {
					this.$message.info(global.i18n.t('请输入验证码'));
					return false;
				}
				if (!validate(this.code, 'captcha')) {
					this.$message.info(global.i18n.t('请输入正确的验证码'));
					return false;
				}
				this.$urouter.redirectTo(
					`/pages/xtsz/changePwdPhone/changePwdPhone?mobile=${this.mobiles}&code=${this.code}`);
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #fff;
		background-size: 100% auto;

		.changePwdPhoneCode_flex_1_higd {
			padding: 103rpx 0rpx 0rpx 0rpx;

			.changePwdPhoneCode_fd1_0_higd {
				font-size: 28rpx;
				font-weight: 400;
				color: var(--benbenFontColor0);
			}

			.changePwdPhoneCode_fd1_1_higd {
				margin: 51rpx 0rpx 40rpx 0rpx;
				line-height: 37rpx;
				font-size: 32rpx;
				font-weight: 500;
				color: var(--benbenFontColor0);
			}

			.changePwdPhoneCode_fd1_3_c0_higd {
				font-size: 28rpx;
				font-weight: 500;
				color: var(--benbenFontColor4);
				text-align: center;
			}

			.changePwdPhoneCode_fd1_4_higd {
				border-radius: 44rpx 44rpx 44rpx 44rpx;
				font-size: 32rpx;
				background: rgba(211, 42, 41, 1);
				color: var(--benbenFontColor3);
				margin: 80rpx 32rpx 0rpx 32rpx;
				height: 88rpx;
				line-height: 88rpx;
				width: 686rpx;
			}
		}

		.changePwdPhoneCode_flex_password_active_fd1_2_higd {
			width: 100rpx;
			height: 100rpx;
			border: 1px solid var(--benbenbdColor4);
		}

		.changePwdPhoneCode_flex_0_higd {
			width: 750rpx;
			height: 88rpx;
			overflow: hidden;
			z-index: 10;
			top: 0rpx;
			background: #fff;
			background-size: 100% auto !important;
			border-bottom: 1px solid #eee;

			.changePwdPhoneCode_fd0_0_higd {
				padding: 0rpx 32rpx 0rpx 32rpx;
				line-height: 88rpx;

				.changePwdPhoneCode_fd0_0_c0_higd {
					width: 100rpx;

					.changePwdPhoneCode_fd0_0_c0_c0_higd {
						font-size: 36rpx;
						font-weight: 400;
						color: #333;
					}
				}

				.changePwdPhoneCode_fd0_0_c1_c0_higd {
					font-size: 36rpx;
					font-weight: 500;
					color: var(--benbenFontColor0);
					line-height: 50rpx;
				}

				.changePwdPhoneCode_fd0_0_c2_higd {
					padding: 0rpx 0rpx 0rpx 0rpx;
					width: 100rpx;
				}
			}
		}
	}

	::v-deep .changePwdPhoneCode_fd1_2_higd {
		width: 750rpx;
		height: 160rpx;
	}
</style>
